package com.lyeducation.sfexpressutil;

import com.sf.openapi.common.entity.MessageResp;
import com.sf.openapi.express.sample.security.dto.TokenRespDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SFController {
    @Autowired
    private SFExpressUtil sfExpressUtil;

    @RequestMapping("http://julang.com/sfCallback/servcie")
    public MessageResp<TokenRespDto> sfCallBack(@RequestBody MessageResp<TokenRespDto> tokenRespMessage) {
        sfExpressUtil.saveTokenRefreshToken(tokenRespMessage.getBody().getAccessToken(), tokenRespMessage.getBody().getRefreshToken());
        return tokenRespMessage;
    }
}
